package com.edu.exam.enums.student;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 学籍异动类型枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum EnrollmentChangeType implements BaseEnum {

    SUSPENSION("SUSPENSION", "休学"),
    RESUMPTION("RESUMPTION", "复学"),
    REPETITION("REPETITION", "留级"),
    DROPOUT("DROPOUT", "退学"),
    TRANSFER("TRANSFER", "转学"),
    GRADUATION("GRADUATION", "毕业"),
    WITHDRAWAL("WITHDRAWAL", "取消学籍");

    private final String code;
    private final String description;

    EnrollmentChangeType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static EnrollmentChangeType fromCode(String code) {
        for (EnrollmentChangeType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown EnrollmentChangeType code: " + code);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}
